From: Tim Starling Date: Sun, 3 Apr 2005 15:18:51 +0000 (+0000) Subject: Page move undo feature X-Git-Tag: 1.5.0alpha1~411 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=8f0f91659d5db006f61ff8c3332f83928e546f5d;p=lhc%2Fweb%2Fwiklou.git Page move undo feature --- diff --git a/includes/SpecialLog.php b/includes/SpecialLog.php index 9725ba722d..4a04482d6d 100644 --- a/includes/SpecialLog.php +++ b/includes/SpecialLog.php @@ -283,9 +283,21 @@ class LogViewer { $userLink = $this->skin->makeLinkObj( $user, htmlspecialchars( $s->user_name ) ); $comment = $this->skin->commentBlock( $s->log_comment ); $paramArray = LogPage::extractParams( $s->log_params ); - + $revert = ''; + if ( $s->log_type == 'move' && isset( $paramArray[0] ) ) { + $specialTitle = Title::makeTitle( NS_SPECIAL, 'Movepage' ); + $destTitle = Title::newFromText( $paramArray[0] ); + if ( $destTitle ) { + $revert = '(' . $this->skin->makeKnownLinkObj( $specialTitle, wfMsg( 'revertmove' ), + 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) . + '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) . + '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) . + '&wpMovetalk=0' ) . ')'; + } + } + $action = LogPage::actionText( $s->log_type, $s->log_action, $title, $this->skin, $paramArray, true ); - $out = "
  • $time $userLink $action $comment
  • \n"; + $out = "
  • $time $userLink $action $comment $revert
  • \n"; return $out; } diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 0f9e5ec922..fc525804f4 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -46,12 +46,14 @@ function wfSpecialMovepage() { */ class MovePageForm { var $oldTitle, $newTitle, $reason; # Text input + var $moveTalk; function MovePageForm() { global $wgRequest; $this->oldTitle = $wgRequest->getText( 'wpOldTitle', $wgRequest->getVal( 'target' ) ); $this->newTitle = $wgRequest->getText( 'wpNewTitle' ); $this->reason = $wgRequest->getText( 'wpReason' ); + $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true ); } function showForm( $err ) { @@ -96,6 +98,13 @@ class MovePageForm { $wgOut->setSubtitle( wfMsg( 'formerror' ) ); $wgOut->addHTML( '

    '.$err."

    \n" ); } + + if ( $this->moveTalk ) { + $moveTalkChecked = " checked='checked'"; + } else { + $moveTalkChecked = ''; + } + $wgOut->addHTML( "
    @@ -121,7 +130,7 @@ class MovePageForm { $wgOut->addHTML( " " ); diff --git a/languages/Language.php b/languages/Language.php index 9135ad2ffd..0b10bd25ee 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1587,6 +1587,7 @@ title. Please merge them manually.', 'movelogpage' => 'Move log', 'movelogpagetext' => 'Below is a list of page moved.', 'movereason' => 'Reason', +'revertmove' => 'revert', # Export
    - + {$movetalk}